﻿using System;
using System.IO;
using System.Web;
using System.Xml;
using SyCODE.Component.Security;
using SyCODE.Component;
using System.Web.Security;

namespace SyCODE.Blog.Uploader
{
    /// <summary>
    /// DeleteFile.aspx 的处理程序
    /// </summary>
    public class DeleteFileHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
			Ticket ticket = Ticket.Get(FormsAuthentication.FormsCookieName);

            if (Ticket.Authenticate(ticket))
            {
                string fileName = Path.Combine(AppPath.GetUserPhysicalPath(ticket.Name), context.Request.Form["fn"]);
                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }
            }
            else
            {
                Function.ClientAlert(StringResource.GetField("authfaild"));
            }
        }
        public bool IsReusable
        {
            get
            {
                return true;
            }
        }
    }
}